package com.fa4j.product.comment.repository.impl;

import com.fa4j.common.data.repository.impl.BaseRepositoryImpl;
import com.fa4j.product.comment.model.Comment;
import com.fa4j.product.comment.repository.CommentRepository;
import com.fa4j.product.comment.repository.mapper.CommentMapper;
import org.springframework.stereotype.Repository;

import java.util.Optional;

/**
 * 持久化接口实现-商品评论
 *
 * @since 2025-11-22 21:06:24
 */
@Repository
public class CommentRepositoryImpl extends BaseRepositoryImpl<CommentMapper, Comment> implements CommentRepository {

    @Override
    public Optional<Comment> countByOrderIdAndSpecId(Long orderId, Integer specId) {
        return super.lambdaQuery()
                .eq(Comment::getOrderId, orderId)
                .eq(Comment::getSpecId, specId)
                .oneOpt();
    }
}


